package org.kiwi.data.cons;

/**
 * Created by jack on 16/10/18.
 */
public class DataConstant {

    // xsd related
    public static final String XSD_ID = "id";
    public static final String XSD_ORDER = "order";
    public static final String ATTRIBUTE_ID = "id";

    // aop config
    public static final String AOP_NAMESPACE_URI = "http://www.springframework.org/schema/aop";
    public static final String EXPRESSION = "expression";
    public static final String ADVICE_REF = "advice-ref";
    public static final String POINTCUT_REF = "pointcut-ref";
    public static final String ADVISOR = "advisor";
    public static final String CONFIG = "config";
    public static final String POINTCUT = "pointcut";

    //read write separation config
    public static final String READ_WRITE_SEPARATION_POINTCUT = "readWriteSeparationPointcut";
    public static final String READ_WRITE_SEPARATION_INTERCEPTOR = "readWriteSeparationInterceptor";

    //db sharding config
    public static final String DB_SHARDING_POINTCUT = "dbShardingPointcut";
    public static final String DB_SHARDING_STRATEGIES = "dbShardingStrategies";
    public static final String DB_SHARDING_INTERCEPTOR = "dbShardingInterceptor";

    //table sharding config
    public static final String TABLE_SHARDING_POINTCUT = "tableShardingPointcut";
    public static final String TABLE_SHARDING_STRATEGIES = "tableShardingStrategies";
    public static final String TABLE_SHARDING_INTERCEPTOR = "tableShardingInterceptor";

    //sharding common config
    public static final String ATTRIBUTE_STRATEGY_SCAN_PACKAGE = "strategy-scan-package";
    public static final String ATTRIBUTE_POINTCUT_EXPRESSION = "pointcut-expression";
    public static final String ATTRIBUTE_CONNECTION_MODE = "connection-mode";

    // interceptor order
    public static final String DB_SHARDING_ADVICE_ORDER = "100";
    public static final String READ_WRITE_SEPARATION_ADVICE_ORDER = "200";
    public static final String TABLE_SHARDING_ADVICE_ORDER = "300";


    //one phase commit
    public static final String ELEMENT_ONE_PHASE_COMMIT = "one-phase-commit";

    // jdbc related
    public static final String DEFAULT_INIT_METHOD = "init";
    public static final String DEFAULT_DESTROY_METHOD = "close";
    public static final String JDBC_MYSQL_PREFIX = "jdbc:mysql://";
    public static final String JDBC_ORACLE_PREFIX = "jdbc:oracle:thin:@";
    public static final String JDBC_DB2_PREFIX = "jdbc:db2://";
    public static final String DB_CONNECTION_COMMON_PARAM = "useUnicode=true&characterEncoding=UTF-8";
    public static final String JDBC_URL_PROP = "url";
    public static final String JDBC_USERNAME_PROP = "username";
    public static final String JDBC_PASSWORD_PROP = "password";
    public static final String JDBC_DRIVER_CLASS_NAME_PROP = "driverClassName";
    public static final String MYSQL_JDBC_DRIVER = "com.mysql.jdbc.Driver";
    public static final String MYSQL_ORACLE_DRIVER = "oracle.jdbc.driver.OracleDriver";
    public static final String MYSQL_DB2_DRIVER = "com.ibm.db2.jdbc.app.DB2Driver";

    //druid pool config
    public static final String INITIAL_SIZE_PROP = "initialSize";
    public static final String MAX_ACTIVE_PROP = "maxActive";
    public static final String MIN_IDLE_PROP = "minIdle";
    public static final String MAX_WAIT_PROP = "maxWait";
    public static final String VALIDATION_QUERY_PROP = "validationQuery";
    public static final String TEST_WHILE_IDLE_PROP = "testWhileIdle";
    public static final String TEST_ON_BORROW_PROP = "testOnBorrow";
    public static final String TEST_ON_RETURN_PROP = "testOnReturn";
    public static final String POOL_PREPARED_STATEMENTS_PROP = "poolPreparedStatements";
    public static final String MAX_POOL_PREPARED_STATEMENT_PER_CONNECTION_SIZE_PROP = "maxPoolPreparedStatementPerConnectionSize";
    public static final String FILTERS_PROP = "filters";

    public static final int DEFAULT_INITIAL_SIZE = 1;
    public static final int DEFAULT_MAX_ACTIVE = 10;
    public static final int DEFAULT_MIN_IDLE = 1;
    public static final long DEFAULT_MAX_WAIT = 10000l;
    public static final String DEFAULT_VALIDATION_QUERY = "select 1 from dual";
    public static final boolean DEFAULT_TEST_WHILE_IDLE = true;
    public static final boolean DEFAULT_TEST_ON_BORROW = true;
    public static final boolean DEFAULT_TEST_ON_RETURN = false;
    public static final boolean DEFAULT_POOL_PREPARED_STATEMENTS = true;
    public static final int DEFAULT_MAX_POOL_PREPARED_STATEMENT_PER_CONNECTION_SIZE = 20;
    public static final String DEFAULT_FILTERS = "stat";

    //RoutingDataSource property
    public static final String TARGET_DATA_SOURCES = "targetDataSources";
    public static final String DEFAULT_TARGET_DATA_SOURCE = "defaultTargetDataSource";

    public static final String READ_WRITE_ENABLED = "readWriteEnabled";
    public static final String LOAD_BALANCE_STRATEGY_MAP = "loadBalanceStrategyMap";

    public static final String LOAD_BALANCER = "loadBalancer";
}
